﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

/// <summary>
/// Summary description for AppServices
/// </summary>
public class AppServices : System.Web.UI.Page
{
    public AppServices()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    //  private ProxyWrapper.UserProxy.UserDetails _objUser = null;
    public ProxyWrapper.UserProxy.UserDetails UserDetails
    {
        get
        {
            return Session["UserObject"] != null ? ((ProxyWrapper.UserProxy.UserDetails)Session["UserObject"]) : null;
        }
    }
    public int ServiceId
    {
        get
        {
            return Convert.ToInt32(Request["ServiceId"] != null ? Request["ServiceId"].ToString() : "0");
        }
    }
    private string _serviceType = "";
    public string ServiceType
    {
        get
        {
            return _serviceType;
        }
    }
    private string _sericeName = "";
    public string DisplayServiceName
    {
        get
        {
            return _sericeName;
        }
    }

    private ProxyWrapper.CommonProxyService.ServiceDetails _srv = null;
    public ProxyWrapper.CommonProxyService.ServiceDetails SrvDetails
    {
        get { return _srv; }

    }
    protected virtual void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (UserDetails == null)
                Response.Redirect("Default.aspx", false);
            DrawPage();
        }
        catch (Exception ex)
        {

        }
    }

    private void DrawPage()
    {
        ProxyWrapper.ServicesServiceWrapper _wrapper = new ProxyWrapper.ServicesServiceWrapper();
        List<ProxyWrapper.CommonProxyService.ServiceDetails> _serviceDetail = _wrapper.GetServiceDetailsList(UserDetails.ClientId, UserDetails.HashCode);//.Select(m => m.ServiceId == ServiceId).ToList();
        ProxyWrapper.CommonProxyService.ServiceDetails _objService = _serviceDetail != null ? _serviceDetail.Where(m => m.ServiceId == ServiceId).ToList()[0] : null;
        _sericeName = _objService.ServiceName;
        _serviceType = _objService.ServiceType;
        _srv = _objService;
    }
}